package io.shqyang.quicklib.base;

import ohos.aafwk.ability.Ability;
import ohos.bundle.IBundleManager;

import java.util.Arrays;

import static io.shqyang.quicklib.base.Constant.PERMISSION_REQUEST_CODE;

public class QuickAbility extends Ability {

    /**
     * request permissions
     * @param permissions   example: new String[] {SystemPermission.READ_USER_STORAGE}
     */
    protected void requestPermission(String[] permissions) {
        if (verifyCallingOrSelfPermission(permissions[0]) != IBundleManager.PERMISSION_GRANTED) {
            requestPermissionsFromUser(permissions, PERMISSION_REQUEST_CODE);
        }
    }

}
